
def partiction(a, l, r):
    value = a[l]
    index = l + 1
    for i in range(l+1, r):
        if a[i] < value:
            a[i], a[index] = a[index], a[i]
            index += 1
    a[index-1], a[l] = a[l], a[index-1]
    return index -1


def quick_sort(a, l, r):
    if r - l  < 1:
        return
    mid = partiction(a, l, r)
    quick_sort(a, l, mid)
    quick_sort(a, mid+1, r)






n = int(input())
a = list(map(int, input().split()))

quick_sort(a, 0, n)


print(*a)



